CentOS 6 编译安装php 5.4 5.5(lamp模式)

  1. 下载php5.4
1
wget http://cn2.php.net/distributions/php-5.4.36.tar.bz2

        5.5下载地址

  1. 解压
1
2
3
tar jxvf php-5.4.36.tar.bz2
cd php-5.4.36
  1. 安装yum扩展源
1
rpm -i 'https://www.apelearn.com/bbs/data/attachment/forum/epel-release-6-8_32.noarch.rpm'
  1. 安装依赖包
1
yum install libxml2-devel libjpeg-* libpng-devel freetype-devel gd-devel libmcrypt-devel openssl-devel
  1. 配置编译参数
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
./configure --prefix=/usr/local/php \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-config-file-path=/usr/local/php/etc \
--with-mysql=/usr/local/mysql \
--with-libxml-dir \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-iconv-dir \
--with-zlib-dir \
--with-bz2 \
--with-openssl \
--with-mcrypt \
--enable-soap \
--enable-gd-native-ttf \
--enable-mbstring \
--enable-sockets \
--enable-exif \
--disable-ipv6
  1. 编译安装
1
make && make install